#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.${artifactId}.dal.es;

import ${package}.${artifactId}.${artifactId}object.DemoProductDO;
import org.springframework.${artifactId}.domain.Page;
import org.springframework.${artifactId}.domain.Pageable;
import org.springframework.${artifactId}.elasticsearch.core.SearchHits;
import org.springframework.${artifactId}.elasticsearch.repository.ElasticsearchRepository;

import java.util.List;

/**
 * @Author: shenyang
 * @CreateTime: 2023-09-18  15:12
 * @Description: TODO
 * @Version: 1.0
 */
public interface ESDemoProductDAO extends ElasticsearchRepository<DemoProductDO, String> {

    //    @Query("{${symbol_escape}"match${symbol_escape}": {${symbol_escape}"productName${symbol_escape}": {${symbol_escape}"query${symbol_escape}": ${symbol_escape}"?0${symbol_escape}", ${symbol_escape}"fuzziness${symbol_escape}": ${symbol_escape}"AUTO${symbol_escape}"}}, ${symbol_escape}"sort${symbol_escape}": {${symbol_escape}"content.length${symbol_escape}": {${symbol_escape}"order${symbol_escape}": ${symbol_escape}"asc${symbol_escape}"}}}")
//    SearchHits<DemoProductDO> searchByContent(String productName);

    Page<DemoProductDO> findByProductNameIn(List<String> productNames, Pageable pageable);

    //    @Query("{${symbol_escape}"match${symbol_escape}": {${symbol_escape}"productName${symbol_escape}": ?0}, ${symbol_escape}"suggest${symbol_escape}": {${symbol_escape}"text${symbol_escape}": ?1, ${symbol_escape}"completion${symbol_escape}": " +
//            "{${symbol_escape}"field${symbol_escape}": ${symbol_escape}"productName${symbol_escape}"}}, ${symbol_escape}"_source${symbol_escape}": [${symbol_escape}"productName${symbol_escape}", ${symbol_escape}"productId${symbol_escape}"]}")
    SearchHits<DemoProductDO> findByProductName(String productName);

}
